#include "../includes/mylist.h"

static int mycmp(int a, int b);

int main(int argc, char **argv) {
    mylist *l = mylist_create(100, mycmp);
    int arr[] = {7, 1, 3, 23, 634, 11, 99, 123, 2121, 1198};
    int size = 10;
    for (int i = 0; i < size; i++)
    {
        mylist_append(l, arr + i);
    }
    mylnode *n1 = l->head;
    int i = 0;
    while ((n1 = n1->next) != l->head)
    {
        printf("[travel list] %d. %d\n", i++, *(int *)n1->data);
    }
    mylist_insert_at(l, arr, 2);
    mylist_delete_at(l, 3);
    mylnode *n = mylist_find_at(l, 4);
    printf("[find] pos: %d, data: %d\n", 4, *(int *)n->data);
    
    n1 = l->head;
    i = 0;
    while ((n1 = n1->next) != l->head)
    {
        printf("[travel list] %d. %d\n", i++, *(int *)n1->data);
    }
    return 0;
}

static int mycmp(int a, int b) {
    return a - b;
}
